package top.arryweb.application.common.constant;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/****
 * @Author:Arry
 * @Description:返回实体Bean
 *****/
@ApiModel(description = "Result",value = "Result")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {

    @ApiModelProperty(value="执行是否成功,true:成功,false:失败",required = true)
    private boolean flag;//是否成功
    @ApiModelProperty(required = true)
    private Integer code;//返回码

    @ApiModelProperty(value="提示信息",required = true)
    private String message;//返回消息

    @ApiModelProperty(value="逻辑数据",required = true)
    private T data;//返回数据

    public Result(boolean flag, Integer code, String message) {
        this.flag = flag;
        this.code = code;
        this.message = message;
    }

    public Result<T> setFlag(boolean flag) {
        this.flag = flag;
        return this;
    }

    public Result<T> setCode(Integer code) {
        this.code = code;
        return this;
    }

    public Result<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public Result<T> setData(T data) {
        this.data = data;
        return this;
    }
}
